/**
 * @file lv_obj.h
 *
 */

#ifndef LV_LV_OBJ_EX_H
#define LV_LV_OBJ_EX_H

#ifdef __cplusplus
extern "C" {
#endif

/*********************
 *      INCLUDES
 *********************/
#include "lvgl.h"

/*********************
 *      DEFINES
 *********************/

/**********************
 *      TYPEDEFS
 **********************/

/**********************
 * GLOBAL PROTOTYPES
 **********************/

/**
 * Delete all sub objects
 * @param obj   pointer to a obj
 * @return      void
 */
void lv_obj_delete_all_child(lv_obj_t * obj);

/**
 * Delete specified object
 * @param obj   pointer to a obj
 * @param child Sub objects to be deleted
 * @return      void
 */
void lv_obj_delete_child(lv_obj_t * obj, lv_obj_t * child);

/**
 * Delete other objects
 * @param obj   pointer to a obj
 * @param child Non deleted sub objects
 * @return      void
 */
void lv_obj_delete_other_child(lv_obj_t * obj, lv_obj_t * child);

/**
 * set all child to have the same attribute
 * @param obj   pointer to a obj, it will be the parent of the new label
 * @param fun       attribute operation function
 * @return      void
 */
void lv_obj_set_all_attrib0(lv_obj_t * obj, void(*fun)(lv_obj_t * obj));

/**
 * set all child to have the same attribute
 * @param obj   pointer to a obj, it will be the parent of the new label
 * @param fun       attribute operation function
 * @param attrib1   attribute1 functions for forced conversion
 * @return      void
 */
typedef void(*lv_obj_fun1_t)(lv_obj_t * obj, uint32_t attrib1);

void lv_obj_set_all_attrib1(lv_obj_t * obj, lv_obj_fun1_t fun, uint32_t attrib1);

/**
 * set all child to have the same attribute
 * @param obj   pointer to a obj, it will be the parent of the new label
 * @param fun       attribute operation function
 * @param attrib1   attribute1 functions for forced conversion
 * @param attrib2   attribute2 functions for forced conversion
 * @return      void
 */
typedef void(*lv_obj_fun2_t)(lv_obj_t * obj, uint32_t attrib1, uint32_t attrib2);

void lv_obj_set_all_attrib2(lv_obj_t * obj, lv_obj_fun2_t fun, uint32_t attrib1, uint32_t attrib2);

/**
 * set all child to have the same attribute
 * @param obj   pointer to a obj, it will be the parent of the new label
 * @param fun       attribute operation function
 * @param attrib1   attribute1 functions for forced conversion
 * @param attrib2   attribute2 functions for forced conversion
 * @param attrib3   attribute3 functions for forced conversion
 * @return      void
 */
typedef void(*lv_obj_fun3_t)(lv_obj_t * obj, uint32_t attrib1, uint32_t attrib2, uint32_t attrib3);

void lv_obj_set_all_attrib3(lv_obj_t * obj,lv_obj_fun3_t fun, uint32_t attrib1, uint32_t attrib2, uint32_t attrib3);

/**
 * set all child to have the same attribute
 * @param obj   pointer to a obj, it will be the parent of the new label
 * @param fun       attribute operation function
 * @return      void
 */
typedef void(*lv_obj_fun0pv_t)(lv_obj_t * obj, void *pv);

void lv_obj_set_all_attrib0pv(lv_obj_t * obj, lv_obj_fun0pv_t fun, void *pv);

/**
 * set all child to have the same attribute
 * @param obj   pointer to a obj, it will be the parent of the new label
 * @param fun       attribute operation function
 * @param pv       the second pointer parameter
 * @param attrib1   attribute1 functions for forced conversion
 * @return      void
 */
typedef void(*lv_obj_fun1pv_t)(lv_obj_t * obj, void *pv, uint32_t attrib1);

void lv_obj_set_all_attrib1pv(lv_obj_t * obj, lv_obj_fun1pv_t fun, void *pv, uint32_t attrib1);

/**
 * set all child to have the same attribute
 * @param obj   pointer to a obj, it will be the parent of the new label
 * @param fun       attribute operation function
 * @param pv       the second pointer parameter
 * @param attrib1   attribute1 functions for forced conversion
 * @param attrib2   attribute2 functions for forced conversion
 * @return      void
 */
typedef void(*lv_obj_fun2pv_t)(lv_obj_t * obj, void *pv, uint32_t attrib1, uint32_t attrib2);

void lv_obj_set_all_attrib2pv(lv_obj_t * obj, lv_obj_fun2pv_t fun, void *pv, uint32_t attrib1, uint32_t attrib2);

/**
 * set all child to have the same attribute
 * @param obj   pointer to a obj, it will be the parent of the new label
 * @param fn       attribute operation function
 * @param pv       the second pointer parameter
 * @param attrib1   attribute1 functions for forced conversion
 * @param attrib2   attribute2 functions for forced conversion
 * @param attrib3   attribute3 functions for forced conversion
 * @return      void
 */
typedef void(*lv_obj_fun3pv_t)(lv_obj_t * obj, void *pv, uint32_t attrib1, uint32_t attrib2, uint32_t attrib3);

void lv_obj_set_all_attrib3pv(lv_obj_t * obj, lv_obj_fun3pv_t fun, void *pv, uint32_t attrib1, uint32_t attrib2, uint32_t attrib3);


/**
 * add all child to have the same event_cb
 * Used by the user to react on event which happens with the object.
 * An object can have multiple event handler. They will be called in the same order as they were added.
 * @param obj       pointer to an object
 * @param filter    an event code (e.g. `LV_EVENT_CLICKED`) on which the event should be called. `LV_EVENT_ALL` can be used to receive all the events.
 * @param event_cb  the new event function
 * @param           user_data custom data will be available in `event_cb`
 * @return          handler to the event. It can be used in `lv_obj_remove_event_dsc`.
 */
lv_event_dsc_t * lv_obj_add_all_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data);


/**********************
 *      MACROS
 **********************/

#ifdef __cplusplus
} /*extern "C"*/
#endif

#endif /*LV_LV_OBJ_EX_H*/
